import request from "@/utils/request";

//获取所有员工
export function getEmployeeList(params) {
    return request({ url: `/sys/user`, method: 'get', params })
}

//删除员工
export function delEmployee(id) {
    return request({ url: `/sys/user/${id}`, method: "delete" })
}

//新增员工
export function addEmployee(data) {
    return request({ url: `/sys/user`, method: 'post', data })
}

//导入数据
export function batchEmployees(data) {
    return request({ url: `/sys/user/batch`, method: 'post', data })
}

//根据id获取用户信息
export function getEmployeeById(id) {
    return request({ url: `/sys/user/${id}`, method: "get" })
}

//修改用户信息
export function saveEmployeeById(id, data) {
    return request({ url: `/sys/user/${id}`, method: "PUT", data })
}

//保存员工个人信息
export function getPersonalInfo(id) {
    return request({ url: `/employees/${id}/personalInfo`, method: 'get' })
}

//保存员工个人信息
export function savePersonalInfo(id, data) {
    return request({ url: `/employees/${id}/personalInfo`, method: 'PUT', data })
}

//获取岗位信息
export function getEmployeeJob(id) {
    return request({ url: `/employees/${id}/jobs`, method: 'get' })
}

//更新岗位信息
export function saveEmployeeJob(id, data) {
    return request({ url: `/employees/${id}/jobs`, method: 'put', data })
}

export function getEmployeeSimple() {
    return request({ url: `/sys/user/simple`, method: 'get' })
}